//
//  NSString+TextSize.m
//  WeiNingProject
//
//  Created by tianjians on 2018/11/29.
//  Copyright © 2018年 卫宁数据. All rights reserved.
//

#import "NSString+TextSize.h"
#import "UIFont+NewFont.h"
@implementation NSString (TextSize)


+(CGSize)getStrSize:(NSString*)text andWidth:(CGFloat)w andFontSize:(CGFloat)fontsize

{
    
    CGSize size = [text boundingRectWithSize:CGSizeMake(w, MAXFLOAT) options:(NSStringDrawingUsesLineFragmentOrigin | NSStringDrawingUsesFontLeading) attributes:@{NSFontAttributeName:[UIFont newFontSize:fontsize fontName:nil]} context:nil].size;
    return size;
    
}

+(CGSize)getStrSize:(NSString*)text andHeight:(CGFloat)h andFontSize:(CGFloat)fontsize
{
    CGSize size = [text boundingRectWithSize:CGSizeMake(MAXFLOAT, h) options:(NSStringDrawingUsesLineFragmentOrigin | NSStringDrawingUsesFontLeading) attributes:@{NSFontAttributeName:[UIFont newFontSize:fontsize fontName:nil]} context:nil].size;
    return size;
    
}


@end
